// 聊天相关
export interface IGetMessagesListByIdParams {
  conversation_id: number
  next_id: number
  num: number
}
export interface IHistoryListItem {
  content: string
  role: 'user' | 'assistant' // 0表示大语言模型 1表示人
}
export interface IMessage {
  message_id: number
  query: string
  answer: string
  docs: string[]
  like_type: LikeState
  query_time: string
}
export interface IAiContent {
  content: string
}
export interface IGetAiResParmas {
  query: string
  conversationId: number
  stream: boolean
  prompt_name: string
}
export interface IKnowlegeBaseChat {
  conversationId: number
  query: string
  knowledge_base_name: string
  stream: boolean
  prompt_name: string
}
export interface IPromptsData {
  prompt_list: string[]
}
export interface IConversationListItem {
  conversation_id: number
  chat_type: string
  kb_name: string
  first_query: string
  time: string
}
export interface IGetConversationIdParams {
  first_query: string
  knowledge_base_name?: string
}
export interface IGetConversationIdData {
  conversation_id?: number
}
export enum LikeState {
  DEFAULT = 0,
  LIKED = 1,
  DISLIKED = 2
}
export interface ILikeAnswerParams {
  message_id: number
  like: LikeState
}
export interface IChatApi {
  getMessagesListById: (
    params: IGetMessagesListByIdParams
  ) => Promise<{ message: IMessage[] }>
  getAiRes: (
    params: IGetAiResParmas,
    callback?: (content: string) => void,
    signal?: AbortSignal
  ) => Promise<IAiContent>
  knowlegeBaseChat: (
    params: IKnowlegeBaseChat,
    callback?: (content: string) => void,
    signal?: AbortSignal
  ) => Promise<IAiContent>
  getPromptsList: () => Promise<IPromptsData>
  getConversationList: () => Promise<IConversationListItem[]>
  deleteConversation: (params: { conversation_id: number }) => Promise<void>
  getConversationId: (
    params: IGetConversationIdParams
  ) => Promise<IGetConversationIdData>
  likeAnswer: (params: ILikeAnswerParams) => Promise<void>
}
